home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech's Sprocket™ / Sprocket-10.14.95 / Release Notes < prev    next >
Encoding:
Text File  |  1995-01-24  |  15.6 KB  |  432 lines  |  [TEXT/MMCC]

  1. #################################################################################################
  2. #
  3. #    Dave’s Release Notes for Sprocket 1.0d23 (1/24/95)
  4. #    (If you just want to see the change history skip ahead to CHANGE HISTORY)
  5. #
  6.  
  7. Threads and “The Futures”
  8. =========================
  9.  
  10. Well, this release marks the first official roll-in of Steve Sisak’s AEThreads and Futures
  11. work. While this stuff is pretty cool, there are a couple of things to worry about:
  12.  
  13. 1) If you are using the ObjectSupportLib (e.g., AEResolve) in your AppleEvent handlers, be aware
  14. that much of the AppleEvent registry assumes only a single application thread. What do I mean
  15. by this?  Well, how’s this: What does “window 1” mean in a multithreaded world where your
  16. application might be creating and destroying windows independently of the user interface?
  17.  
  18. 2) Greg Anderson, “a Finder kinda guy” at Apple was busy hacking the scriptable finder the
  19. other day and without knowing it, completely implemented another version of the Futures
  20. package. Sometime in the next century, a DEVELOP magazine article will be coming out outlining
  21. what he did, so be aware that we may attempt to merge his code with Steve’s work-- they
  22. both started from the original code from DEVELOP, so it shouldn’t be too tough.
  23.  
  24. 3) We’l probably be making some significant changes to the AppleEvent and Threading code to
  25. deal with ARM C++-like exception handling.  By the time we get to this, just about every
  26. C++ compiler for the Mac will support real exception handling anyway (THINK C 8.0 seems to
  27. do this, from what I’ve heard; Apple plans to support real exceptions in MrC; and Greg Galanos
  28. already has it on his schedule somewhere).  The work here is that we want to support threadded
  29. AppleEvent handling, some cool object model stuff (from Eric Berdahl, Taligent cult member),
  30. and make it all work with exceptions.
  31.  
  32.  
  33. CodeWarrior, Symantec, and Semantics
  34. ====================================
  35.  
  36. Sprocket now requires the use of the Universal Headers 2.0a3. These headers can be
  37. found in CW5 and future versions of the Symantec C++ enironments.
  38.  
  39. If you are using THINK C, you can either hack the source, or grab the headers [HMMM URL???].
  40.  
  41. While we’ve made an attempt at making Sprocket work better in THINK C 7.0, we will
  42. try to make things better in the future for every environment (including MPW).
  43.  
  44. This will become more important as we start trying to take advantage of features like
  45. C++ exception handling, while still trying to be multi-threadable.
  46.  
  47.  
  48. Better (or Just Plain Different) Menus
  49. ======================================
  50.  
  51. The biggest change in Sprocket has been a major rearchitecting of menu command handling.
  52. We now have a TMenuBar object which keeps track of “<menu,item> -> <command>” mappings
  53. in a VERY similar manner to what is used in OpenDoc™.
  54.  
  55. Here’s a quick look at the methods of TMenuBar that are interesting to you:
  56.  
  57. class TMenuBar
  58.     {
  59.     OSErr                    GetNewMenuBar(short whichMBAR);
  60.     MenuRef                    GetMenuFromCMNU(short whichMenu);
  61.     
  62.     . . .
  63.  
  64.     MenuCommandID            GetCommand(MenuID menu, MenuItemID item);
  65.     void                    GetMenuAndItem(MenuCommandID commandNum, MenuID * returnedMenu, MenuItemID * returnedItem);
  66.     
  67.     OSErr                    RegisterCommand(MenuCommandID commandNum, MenuID menu, MenuItemID item);
  68.     OSErr                    UnregisterCommand(MenuCommandID commandNum);
  69.     
  70.     void                    EnableCommand(MenuCommandID commandNum, Boolean enable);
  71.     void                    EnableAndCheckCommand(MenuCommandID commandNum, Boolean enable, Boolean check);
  72.  
  73.     void                    GetItemString(MenuCommandID commandNum,StringPtr itemString);
  74.     void                    SetItemString(MenuCommandID commandNum,StringPtr itemString);
  75.  
  76.     . . .
  77.     };
  78.  
  79. The basic idea is that each menu item can have a MenuCommandID (a.k.a. unsigned long) attached
  80. to it. In this way, you can simply assign a numeric constant (e.g., 1000) to a menu item, and
  81. then NEVER EVER CARE where that item actualy lives in your menubar!
  82.  
  83. In order to an attach a MenuCommandID to a particular menu and item, simple call the method
  84. RegisterCommand:
  85.  
  86.     gMenuBar->RegisterCommand(cNewWidget,mFileMenu,iNewWidget);
  87.  
  88.  
  89. “But that’s not Macintosh”
  90. --------------------------
  91.  
  92. If you don’t like having to register commands programmatically, you can do what normal folks
  93. do: use resources. Unlike OpenDoc™, we support menu resources which can automatically register
  94. commands without the need for calling RegisterCommand.
  95.  
  96. Strangely enough, a new resource type for menus with “longint” commands (CMNUs), was created
  97. for MacApp. In the spirit of never doing work you don’t need to do, we happily choose this
  98. resource type for Sprocket’s menu template resources-- ResEdit and Resourceror already know
  99. how to edit CMNUs. [Watch out, ResEdit 2.1.3 will not change the menuID field when renumbering
  100. a CMNU resource as it does with MENU resources].
  101.  
  102. Unlike MacApp, we don’t do much evil menu manager hacking and lowmem slamming, we use the
  103. CMNU resource as a template, and construct the corresponding menu via normal menu manager
  104. routines. In order to do this, you can either use the methods GetNewMenuBar and/or
  105. GetMenuFromCMNU.
  106.  
  107.  
  108. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  109. An OpenDoc Tangent:
  110.  
  111. By the way, if you ARE building an OpenDoc part, you might want to check out two of the
  112. methods in TMenuBar:
  113.  
  114.     OSErr        GetNewMenuBar(short resourceID);
  115.  
  116.     Our version of the toolbox routine GetNewMBar which supports CMNU resources. Also
  117.     unlike GetNewMBar, our routine goes ahead an operates on the current menubar. You
  118.     will have to make some changes to make this function OpenDoc-savvy (like dealing
  119.     with ODPlatformMenus instead of MenuRefs, etc.)
  120.     
  121.     MenuRef        GetMenuFromCMNU(short resourceID);
  122.  
  123.     This routines takes a CMNU resource ID, and returns a MenuRef (a.k.a. MenuHandle)
  124.     based on the content of the resource. If no CMNU is found, the result is NULL.
  125.  
  126. With some hacking these routines should be useful for making your OpenDoc part less
  127. “hardcoded” and more resource data-driven. If you don’t want to mess with SOM, I’d
  128. suggest just making these utility functions in your part.
  129. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  130.  
  131. Now, back to our program
  132. ------------------------
  133.  
  134. Like the OpenDoc stuff, you can enable/disable/check/change a menu item just by specifying
  135. the command number, instead of a menu and item. This is handy for dealing with controlling
  136. dynamic commands:
  137.  
  138.     void TMyWindow::Activate(Boolean activating)
  139.         {
  140.          . . .
  141.         if (activating)
  142.             gMenuBar->EnableCommand(cClose,this->CanClose());
  143.          . . .
  144.         }
  145.         
  146. For now, we’re prepending command constants with a lowercase “c”. This is the MacApp
  147. convention ("c" is for command, as in cClose). This has an unfortunate overlap with
  148. the AppleEvent Registry’s naming scheme ("c" is for class, as in cDocument or cWindow).
  149.  
  150. Eventually, we’ll probably implement a TCommand class to better support Undo, Redo,
  151. and recordabiity. Since many small application don’t require this, we’ve decided to push
  152. this off to another deadline.
  153.  
  154.  
  155. What does this all mean for you?
  156. --------------------------------
  157.  
  158. The big change for applications built in Sprocket is that HandleMenu has now been rolled
  159. into the Sprocket-baseline.
  160.  
  161. If you could care less about all this, you can rename your old HandleMenu routine
  162. to be called HandleMenuSelection, and get rid of the first parameter (a TWindow *):
  163.  
  164. void
  165. HandleMenuSelection(MenuID theMenu, MenuItemID theItem)
  166.     {
  167.     . . .
  168.     }
  169.  
  170. Notice that you don’t have to deal with desk accessories any more, or all that
  171. “if (!SystemEdit)” crud for the Edit menu anymore.
  172.  
  173.  
  174. If you want to use command-based menus, you need to add a routine which gets called
  175. when a menu item with a command is selected:
  176.  
  177. void HandleMenuCommand(MenuCommandID command)
  178.     {
  179.     switch (command)
  180.         {
  181.         . . .
  182.         case    cAbout:
  183.             MyCoolAboutBox();
  184.             break;
  185.             
  186.         case    cMyCoolCommand:
  187.             DoMyCoolCommand();
  188.             break;
  189.         . . .
  190.         }
  191.     }
  192.  
  193. [NOTE:    To make your life a bit easier, Sprocket will automatically invoke QuitApplication()
  194. when a menu is selected with a command number == cQuit.]
  195.  
  196.  
  197. Unlike earlier versions of Sprocket, there is no need to handle every command in these
  198. functions.  Part of this is due to Sprocket getting a bit smarter when dealing with
  199. windows and menu handling. Three new methods have been added to TWindow:
  200.  
  201.     class TWindow
  202.         {
  203.         . . .
  204.         virtual    void        AdjustMenusBeforeMenuSelection(void);
  205.         virtual void        DoMenuSelection(short menu, short item);
  206.         virtual Boolean        DoMenuCommand(MenuCommandID menuCommand);
  207.         . . .
  208.         };
  209.  
  210. AdjustMenusBeforeMenuSelection, is a hook method has also been provided to allow your program
  211. to enable and disable menu items just before a MenuSelect or MenuKey call is made. This is
  212. useful for checking the current font in the Fonts menu, etc.
  213.  
  214. Speaking of the Font menu, the DoMenuSelection hooks is provided for handling menu items
  215. without registered commands.
  216.  
  217. DoMenuCommand is called to pass menu commands directly to the frontmost non-floating window via
  218. a DoMenuCommand method. Another nifty change is to make TWindow deal with closing a window
  219. from the menubar:
  220.  
  221. Boolean
  222. TWindow::DoMenuCommand(MenuCommandID command)
  223.     {
  224.     . . .
  225.     if (command == cClose)
  226.         {
  227.         if (this->Close() && this->DeleteAfterClose())
  228.             delete this;
  229.         return true;
  230.         }
  231.     . . .
  232.     }
  233.  
  234. In order to get this behavior you should call through TWindow::Close() from within your own
  235. derived classes.
  236.  
  237. One thing to note is that since menu commands are routed through non-floating (e.g., document)
  238. windows only, you must handle menu commands for windoids inside your application’s
  239. HandleMenuCommand function.
  240.  
  241.  
  242. TDocument
  243. =========
  244.  
  245. Work on a real TDocument class has begun, and as a result StandardCloseDocument is in
  246. limbo. If you need to use this in the short term, I’d suggest just using the old code.
  247.  
  248. A couple of us will be doing some brainstorming about this one.  We don’t want people
  249. to be forced into making their applications “document-based”. This is one of the big
  250. limitations of MacApp, and even OpenDoc-- being document-centric tends to add extra
  251. classes and support routines that aren’t needed for utility functions, cool hacks, or
  252. video games.
  253.  
  254.  
  255. Bugs? What bugs?
  256. ================
  257.  
  258. We’ve also managed to fix a number of bugs in Sprocket:
  259.  
  260.     Dave Mark            :    Dealt with early bugs and helped make things easier
  261.     David denBoer        :    Window activation bugs in TWindow::Select
  262.     Leonard Rosenthal    :    Better TSM support
  263.     Randy Thelen        :    Thread performance when quitting & SplashWindow bugs
  264.     Gary Powell            :    TDialogWindow, DialogUtils, C++ disciplines
  265.  
  266. Some of the GX initialization has been rearranged as suggested by Jon Summers who used
  267. Sprocket to build a PDD (portable digital document) viewer.
  268.  
  269. A double-dispose problem with the SplashWindow was fixed, and we even decided to support
  270. “empty” splash windows.
  271.  
  272.  
  273. What to expect in the future:
  274. =============================
  275.  
  276. Real documents and GX-savvy printing
  277. Thread-safe exception handling (the next thing requires it)
  278. AppleEvent Object Support for Scripting
  279. A Plug-in architecture (wouldn’t THAT be a cool article for someone to write?)
  280. Embedding OpenDoc and/or OLE things in Sprocket windows
  281.  
  282.  
  283. #########################
  284. CHANGE HISTORY for 1.0d23
  285. #########################
  286.  
  287. The changes in detail (more or less):
  288.  
  289.     AEThreads.c,1
  290.     AEThreads.h,1
  291.     Futures.c,1
  292.     Futures.h,1
  293.         Added Steve Sisak’s changes to Sprocket to support installing threaded
  294.         AppleEvent handlers and Futures.
  295.         
  296.     DialogWindow.h,4
  297.     DialogWindow.cp,8
  298.         Adapt to new Menu handling methodology. Also protected the constructor,
  299.         as this is really an abstract class.
  300.  
  301.         Also fixed bug where we weren’t disposing of TDialogWindows using DisposeDialog.
  302.  
  303.     MenuBar.h,3
  304.     MenuBar.cp,3
  305.         Added support for CMNU resources, which allows for menu commands to automatically
  306.         be registered without code modification. (cool, eh?) We don’t yet support 'mctb'
  307.         resources for these types.
  308.  
  309.     Sprocket.h,12
  310.         Added cPreferences command constant.
  311.  
  312.     DialogUtils.cp,8
  313.         Gary Powell is a bug finding god. Fix an unitialized variable problem in ErrorAlert.
  314.  
  315.     SplashWindow.cp,8
  316.         Fix a double-dispose bug: there is no need to get rid of a window’s picture.
  317.         DisposeWindow will already KillPicture it.
  318.  
  319.     SprocketMain.cp,17
  320.         Use our own special version of GetNewMenuBar which should automatically register menu
  321.         commands found in CMNU resources.
  322.         
  323.     Window.h,8
  324.     Window.cp,14
  325.         Fix the “calling DisposeWindow on DialogPtr” problem reported by Gary Powell @ Adobe
  326.         by adding a cheezy flag that NTWindow initializes, but TDialogWindow slams.
  327.         In TWindow::Close, we check this flag and call DisposeDialog instead of DisposeWindow,
  328.         surely preventing memory leaks for complex dialogs.
  329.  
  330.     CreditsBox.rsrc,3
  331.         Added Gary Powell & Marshall Clow
  332.  
  333.     Sprocket.rsrc,5
  334.         bumped 'vers' (2) to d22.
  335.  
  336. Stuff that was checked in, but isn’t ready for prime time:
  337.  
  338.     Document.cp,1
  339.     Document.h,1
  340.     Exceptions.cp,1
  341.     Exceptions.h,1
  342.     UAppleObject.cp,1
  343.     UAppleObject.h,1
  344.  
  345.  
  346.  
  347. # ————————————————————————————————————————————————————————————————————————
  348. #    Dave’s Quick and Dirty Release Notes for Sprocket95™ 1/3/95
  349.  
  350. #        Dynamic arrays
  351. #
  352. #        Added a dynamic array base class for efficient collections
  353. #        of object references. Also added a sorted dynamic array
  354. #        class which can be used to keep a sorted list.
  355.  
  356. :Sprocket:Interfaces:DynamicArray.h,1
  357. :Sprocket:Lib:DynamicArray.cp,1
  358. :Sprocket:Interfaces:SortedDynamicArray.h,1
  359. :Sprocket:Lib:SortedDynamicArray.cp,1
  360.  
  361.  
  362. #        Menu command handling ala OpenDoc™
  363. #        (NOTE: This will be accompanied by an upcoming article)
  364. #
  365. #        A basic class for maintaing the state of the menu bar is
  366. #        another work in progress for an upcoming article. TMenuBar
  367. #        maintains <menu,item> <-> <command> mappings for items
  368. #        in the menu bar. The methods for TMenuBar deliberately
  369. #        resemble those of OpenDoc’s ODMenuBar.
  370. #
  371. #        Unlike OpenDoc, there is only a single, global menubar
  372. #        supported. This MAY change when we decide to support plug-ins
  373. #        and/or embedding of OpenDoc parts.
  374. #
  375. #        Support for building a TMenuBar from an MBAR and (MENU or CMNU)
  376. #        resources has yet to be written, so commands must be manually
  377. #        registered via the RegisterCommand method.
  378.  
  379. :Sprocket:Interfaces:MenuBar.h,1
  380. :Sprocket:Lib:MenuBar.cp,1
  381.  
  382.  
  383. #        Rudimentary document support
  384. #
  385. #        NOTE: This will be accompanied by an upcoming article
  386. #
  387. #        NOTE: This stuff is potentially completely *bogus* and is
  388. #                subject to massive changes in the future.
  389. #
  390. #        In order to better support things like saving and printing
  391. #        in the future, I’m working on a TDocument class. Things like
  392. #        a standard close options dialog, a GX-savvy print loop, etc.
  393. #        will eventually go here. There is also a TDocWindow class
  394. #        for linking a window to a given TDocument.
  395.  
  396. :Sprocket:Interfaces:Document.h,1
  397. :Sprocket:Lib:Document.cp,1
  398. :Sprocket:Interfaces:DocWindow.h,1
  399. :Sprocket:Lib:DocWindow.cp,1
  400.  
  401.  
  402. #    General maintenance
  403.  
  404. #        Some changes were made in order to adapt to the new menu
  405. #        command scheme:
  406. #
  407. #        TWindow’s DoMenuCommand and AdjustMenusBeforeMenuSelection methods
  408. #        should now work properly, providing simpler menu handling.
  409. #
  410. #        Applications can provide a HandleMenuCommand procedure to handle
  411. #        non-window specific commands. This procedure doesn’t need to do
  412. #        anything.
  413. #
  414. #        Applications must also register a quit command so they will be
  415. #        properly terminated. (NOTE: There is no need to handle Quit within
  416. #        the HandleMenuCommand procedure)
  417.  
  418. #        Fixed a bug in TSplashWindow which created a stupid minature window
  419. #        even if we didn’t have a splash screen PICT.
  420.  
  421. #        We also added some cool drag manager utilities and TWindow methods
  422. #        from Nitin Ganatra author of Malph, a way-cool utility.
  423.  
  424. :Sprocket:Interfaces:Window.h,5
  425. :Sprocket:Interfaces:Sprocket.h,9
  426. :Sprocket:Lib:DialogUtils.cp,7
  427. :Sprocket:Lib:DragUtils.cp,3
  428. :Sprocket:Lib:SplashWindow.cp,7
  429. :Sprocket:Lib:SprocketMain.cp,15
  430. :Sprocket:Lib:Window.h,6
  431. :Sprocket:Lib:Window.cp,12
  432.